<include file="Public/min-header" />
<link href="__PUBLIC__/plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
<script src="__PUBLIC__/plugins/daterangepicker/moment.min.js" type="text/javascript"></script>
<script src="__PUBLIC__/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
<style>
td {
    height: 40px;
    line-height: 40px;
    padding-left: 20px;
}

.span_1 {
    float: left;
    margin-left: 0px;
    height: 130px;
    line-height: 130px;
}

.span_1 ul {
    list-style: none;
    padding: 0px;
}

.span_1 ul li {
    border: 1px solid #CCC;
    height: 40px;
    padding: 0px 10px;
    margin-left: -1px;
    margin-top: -1px;
    line-height: 40px;
}
</style>
<div class="wrapper">
    <include file="Public/breadcrumb" />
    <section class="content" style="padding:0px 15px;">
        <div class="container-fluid">
            <div class="pull-right">
                <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="返回"><i class="fa fa-reply"></i></a>
            </div>
            <div class="panel panel-default">
                <div class="panel-body ">
                    <ul class="nav nav-tabs">
                        <foreach name="groupList" item="vo" key="k">
                            <li <if condition="$k eq 'water'">class="active"</if>><a href="javascript:;" data-url="{:U('System/index',array('inc_type'=>$k))}" data-toggle="tab" onclick="goset(this)">{$vo}</a></li>
                        </foreach>
                    </ul>
                    <form method="post" id="handlepost" action="{:U('System/handle')}">
                        <!--通用信息-->
                        <div class="tab-content" style="padding:20px 0px;">
                            <div class="tab-pane active" id="tab_tongyong">
                                <table class="table table-bordered">
                                    <tbody>
                                        <tr>
                                            <td class = "align-right">商品图片添加水印：</td>
                                            <td>
                                                <input type="radio" name="is_mark" value="1" <if condition="$config['is_mark'] eq 1">checked</if>> 是
                                                <input type="radio" name="is_mark" value="0" <if condition="$config['is_mark'] eq 0">checked</if>> 否
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class = "align-right">水印类型：</td>
                                            <td>
                                                <input type="radio" name="mark_type" value="text" onclick="setwarter('text')" <if condition="$config['mark_type'] eq 'text'">checked</if>> 文字
                                                <input type="radio" name="mark_type" value="img" onclick="setwarter('img')" <if condition="$config['mark_type'] eq 'img'">checked</if>> 图片
                                            </td>
                                        </tr>
                                        <tr id="texttr" style="display:none;">
                                            <td class = "align-right">水印文字：</td>
                                            <td>
                                                <input type="text" style="width:300px;" name="mark_txt" id="mark_txt" value="{$config.mark_txt}">
                                            </td>
                                        </tr>
                                        <tr id="imgtr" style="display:none;">
                                            <td class = "align-right">水印图片：</td>
                                            <td>
                                                <input type="text" style="width:300px;" name="mark_img" id="mark_img" value="{$config.mark_img}" class = "form-control">
                                                <input type="button" onclick="GetUploadify(1, '', 'Public', 'call_back');" value="上传图片" >
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class = "align-right">水印添加条件：</td>
                                            <td>
                                                <input type="number" pattern="^\d{1,}$" title="只能输入数字" name="mark_width" value="{$config.mark_width}" class = "mb-10 input-sm"> 图片宽度 单位像素(px)
                                                <br/>
                                                <input type="number" pattern="^\d{1,}$" title="只能输入数字" name="mark_height" value="{$config.mark_height}" class = "input-sm"> 图片高度 单位像素(px)
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class = "align-right">水印透明度：</td>
                                            <td>
                                                <input type="range" style="width:300px;display:inline;" onChange="mark_degree2.value = this.value" value="{$config.mark_degree}" name="mark_degree" min="1" step="2" max="100" />
                                                <output id="mark_degree2" style="display:inline;color:red;">{$config.mark_degree}</output>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0代表完全透明，100代表不透明
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class = "align-right">JPEG 水印质量：</td>
                                            <td>
                                                <input type="range" style="width:300px;display:inline;" onChange="mark_quality2.value = this.value" value="{$config.mark_quality}" name="mark_quality" min="1" step="2" max="100" />
                                                <output id="mark_quality2" style="display:inline;color:red;">{$config.mark_quality}</output>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 水印质量请设置为0-100之间的数字,决定 jpg 格式图片的质量
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class = "align-right">水印位置：</td>
                                            <td>
                                                <div style="height:124px; background:#fff">
                                                    <span class="span_1">
                                                    <ul>
                                                        <li><input type="radio" name="sel" value="1"<if condition="$config['sel'] eq '1'">checked</if>>&nbsp;顶部居左</li>
                                                        <li><input type="radio" name="sel" value="2" <if condition="$config['sel'] eq '2'">checked</if>>&nbsp;中部居左</li>
                                                        <li><input type="radio" name="sel" value="3" <if condition="$config['sel'] eq '3'">checked</if>>&nbsp;底部居左</li>
                                                    </ul>   
                                                </span>
                                                    <span class="span_1">
                                                    <ul>
                                                        <li><input type="radio" name="sel" value="4" <if condition="$config['sel'] eq '4'">checked</if>>&nbsp;顶部居中</li>
                                                        <li><input type="radio" name="sel" value="5" <if condition="$config['sel'] eq '5'">checked</if>>&nbsp;中部居中</li>
                                                        <li><input type="radio" name="sel" value="6" <if condition="$config['sel'] eq '6'">checked</if>>&nbsp;底部居中</li>
                                                    </ul>   
                                                </span>
                                                    <span class="span_1">
                                                    <ul>
                                                        <li><input type="radio"  name="sel" value="7" <if condition="$config['sel'] eq '7'">checked</if>>&nbsp;顶部居右</li>
                                                        <li><input type="radio"  name="sel" value="8" <if condition="$config['sel'] eq '8'">checked</if>>&nbsp;中部居右</li>
                                                        <li><input type="radio"  name="sel" value="9" <if condition="$config['sel'] eq '9'">checked</if>>&nbsp;底部居右</li>
                                                    </ul>   
                                                </span>
                                                    <div style="clear:both;"></div>
                                                </div>
                                            </td>
                                        </tr>
                                    </tbody>
                                    <tfoot>
                                        <tr>
                                            <td>
                                                <input type="hidden" name="inc_type" value="{$inc_type}">
                                            </td>
                                            <td class="text-right">
                                                <input class="btn btn-primary" type="buuton" onclick="adsubmit()" value="保存">
                                            </td>
                                        </tr>
                                    </tfoot>
                                </table>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </section>
</div>
<script>
function adsubmit() {
    $('#handlepost').submit();
}

$(document).ready(function() {
    get_province();
    var marktype = "{$config['mark_type']}";
    if (marktype == 'text') {
        $('#texttr').show();
    } else {
        $('#imgtr').show();
    }
});

function goset(obj) {
    window.location.href = $(obj).attr('data-url');
}

// 上传水印图片成功回调函数
function call_back(fileurl_tmp) {
    $("#mark_img").val(fileurl_tmp);
}

function setwarter(marktype) {
    if (marktype == 'text') {
        $('#texttr').show();
        $('#imgtr').hide();
    } else {
        $('#texttr').hide();
        $('#imgtr').show();
    }
}
</script>
</body>

</html>
